import emitter from "../emitter";
import playerDataInfo from "../playerData";
const { ccclass, property } = cc._decorator;
@ccclass
export default class enemyPlaneCollider extends cc.Component {
    isCollider = false;
    setPlaneHarm;
    onCollisionEnter(other, self) {
        if (this.isCollider) return
        this.isCollider = true;
        if (other.node.group == "player_bullet") {
            //回收子弹
            emitter.emit("recycle", other.node.parent);
            let bullet = other.node.parent.getComponent("bullet");
            if (!bullet || !bullet.bulletHarm) return
            bullet.isStop = true;
            //@ts-ignore
            if (this.setPlaneHarm) this.setPlaneHarm(playerDataInfo.gameData.playerLevel);
        }
        else if (other.node.group == 'jiGuang') {
            //@ts-ignore
            let harm = playerDataInfo.gameData.playerLevel * 6;
            //@ts-ignore
            if (this.setPlaneHarm) this.setPlaneHarm(harm);
        }
    }

    onCollisionExit() {
        this.isCollider = false;
    }
}
